package self.hoy.demo.cloud.seata.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import self.hoy.demo.cloud.entities.CommonResult;
import self.hoy.demo.cloud.seata.service.StorageService;

import javax.annotation.Resource;

/**
 * @author 三共小不
 * @date 2020/6/21
 */
@RestController
public class StorageController {
    @Resource
    private StorageService storageService;

    @RequestMapping("/storage/decrease")
    public CommonResult decrease(@RequestParam("productId") Long productId,
                                 @RequestParam("count") Integer count) {
        storageService.decrease(productId, count);
        return new CommonResult(200,"扣减库存成功!");
    }
}
